package xin.nick.cloud;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;

@Component
@Order(1)  // 控制类执行的顺序越小越靠前
@Slf4j
public class StartInitializer implements CommandLineRunner {

    @Autowired
    private Environment environment;

    @Override
    public void run(String... args) throws Exception {
        System.out.println("项目启动,执行 CommandLineRunner 实现类的方法");
        String path = environment.getProperty("my.exclude.path");
        log.info("排除的path : {}", path);
    }
}
